package marsdonne.flink.connectors;

import org.apache.flink.api.common.serialization.SerializationSchema;
import org.apache.flink.streaming.connectors.rabbitmq.RMQSinkPublishOptions;
import org.apache.flink.streaming.connectors.rabbitmq.SerializableReturnListener;
import org.apache.flink.streaming.connectors.rabbitmq.common.RMQConnectionConfig;

import java.io.IOException;
import java.util.Map;

public class RMQSink<IN> extends org.apache.flink.streaming.connectors.rabbitmq.RMQSink<IN> {
    public RMQSink(RMQConnectionConfig rmqConnectionConfig, String queueName, SerializationSchema schema) {
        super(rmqConnectionConfig, queueName, schema);
    }

    public RMQSink(RMQConnectionConfig rmqConnectionConfig, SerializationSchema schema, RMQSinkPublishOptions publishOptions) {
        super(rmqConnectionConfig, schema, publishOptions);
    }

    public RMQSink(RMQConnectionConfig rmqConnectionConfig, SerializationSchema schema, RMQSinkPublishOptions publishOptions, SerializableReturnListener returnListener) {
        super(rmqConnectionConfig, schema, publishOptions, returnListener);
    }

    @Override
    protected void setupQueue() throws IOException {
        if (this.queueName != null) {
            this.channel.queueDeclare(this.queueName, true, false, false, (Map)null);
        }
    }
}
